package com.example.teesystem.common.utils;

import cn.hutool.core.convert.Convert;
import lombok.experimental.UtilityClass;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@UtilityClass
public class CustomConvert {
    public String convertToString(List<Integer> list) {
        StringBuffer stringBuffer = new StringBuffer();
        list.forEach(id -> stringBuffer.append(id).append(","));
        return stringBuffer.substring(0, stringBuffer.length() - 1);
    }
    
    public List<Integer> convertToList(String str) {
        return Arrays.stream(str.split(","))
                .map(Convert::toInt)
                .collect(Collectors.toList());
    }
}
